package com.allianz.webapps.controllers;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.allianz.webapps.https.interfaces.appChgProduct.ChgProduct;
import com.allianz.webapps.orderspojo.App;
import com.allianz.webapps.orderspojo.AppBase;
import com.fasterxml.jackson.databind.ObjectMapper;

//http://localhost:8080/pad_marketing/main/chgProductBody.action
@Controller
@RequestMapping(value="main")
public class AppChgpProductController {
	
	@Autowired
	private ObjectMapper objectMapper;
	@Autowired
	private ChgProduct cpd;
	
	/**
	 *  请求接口获取页面，加载数据
	 */
	@RequestMapping(value="chgProductBody")
	@ResponseBody
	public String chgProductBody(@RequestParam(value="jsonParam") String jsonParam, HttpServletRequest request,HttpServletResponse response)
			throws Exception{
		
		AppBase appBase=objectMapper.readValue(jsonParam, AppBase.class);
		String body=cpd.requestLoginParam(appBase);
		return body;
	}
	
}
